PRINTING HERCULES GRAPHICS SCREENS WITH QUICKBASIC 4.0 ------------------------------------------------------ To fully understand how to print graphics screens generated by Hercules and fully compatible graphics adapters, it is necessary to understand how Hercules graphics memory is set up. Hercules memory starts at hex paragraph B000 (decimal 45056). Graphics memory starts with page zero at hex paragraph B000 (45056), and page one at hex para-graph B800 (47104) which is B000H + 800H, or a 32K page (800H * 10H = 8000H or 32768). However, graphics memory is not contiguous memory, as we will see later. Each line of pixels on both pages of screen mode 3 consists of 90 bytes. Thus, the top line of pixels on page zero (B000) would go from B000 + 0 to B000 + 59 (45056 + 89). To draw a line from the upper left corner of the screen to the upper right corner of the screen on page zero, we would simply POKE 255 into positions 0 through 89 (255 = all 8 bits per byte being "on"): SCREEN 3 DEF SEG = &HB000 FOR x = 0 TO 89 ' B000H:0000H to B000H:0059H POKE x, 255 NEXT x To do the same thing on page one, simply change the value of the DEF SEG statement to &HB800 (B000H + 800H). However, the graphics memory is not contiguous. If we continue to draw at B000H + 5AH, the next line will appear three lines down from the first. In order to draw a line on the second line, we must add 2000H to the address of the first byte on the first line: FOR x = 8192 TO 8281 ' B000H:2000H to B000H:2059H POKE x, 255 NEXT x This must also be done for line three and line four. Thus, the first byte of line three would be B000H:4000H and the first byte of the fourth line would be B000H:6000H. The first byte of line five would be B000H:005AH (45056:0090) and so on for every four lines down the screen. The same applies for page one. Please see the figure on page 89 of "The Programmer's Guide to PC and PS/2 Video Systems", by Richard Wilton [Microsoft Press, 1987] for a diagram of the Hercules video buffer in graphics mode. The listings included in this archive print a Hercules graphics screen (page zero) to either an Epson or compatible printer, or an HP LaserJet family printer. If you have a different printer, you will need to change the printer commands for setting line spacing and graphics mode for your printer. To print page one, add 800H (2048) to the DEF SEG statement.